package com.demo.paypalmanagement.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.demo.paypalmanagement.common.CommonUtils;
import com.demo.paypalmanagement.common.ResultMsg;
import com.demo.paypalmanagement.config.response.BizException;
import com.demo.paypalmanagement.model.entity.LotteryRecord;
import com.demo.paypalmanagement.model.entity.Users;
import com.demo.paypalmanagement.model.vo.LotteryRecordVO;
import com.demo.paypalmanagement.service.LotteryRecordService;
import com.demo.paypalmanagement.mapper.LotteryRecordMapper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author Administrator
* @description 针对表【lottery_record(抽奖记录)】的数据库操作Service实现
* @createDate 2024-12-18 15:35:37
*/
@Service
public class LotteryRecordServiceImpl extends ServiceImpl<LotteryRecordMapper, LotteryRecord>
    implements LotteryRecordService{

    @Autowired
    private CommonUtils commonUtils;

    @Autowired
    private LotteryRecordMapper lotteryRecordMapper;

    @Override
    public Page<LotteryRecordVO> customPage(Page<LotteryRecord> page, LotteryRecordVO vo) {
        Users userInfo = commonUtils.getUserInfo();
        if (Integer.parseInt(userInfo.getUserRole()) < 2 ) {
            vo.setUserId(userInfo.getId());
        }
        return lotteryRecordMapper.customPage(page,vo);
    }
}




